import 'package:bruno/bruno.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:xiongmao_clean_flutter_module/widgets/custom_avatar_view.dart';

import '../../../../res/colors.dart';
import '../../../../res/gaps.dart';

/**
 * 保单详情
 */
class InsureDetailsPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: BrnAppBar(
        title: '保单详情',
      ),
      backgroundColor: Colours.base_primary_bg_page,
      body: SingleChildScrollView(
        child: Column(
          children: [
            //保单信息
            Container(
              color: Colors.white,
              margin: EdgeInsets.only(top: 10),
              padding: EdgeInsets.only(left: 16, right: 16, top: 10, bottom: 10),
              child: Column(
                children: [
                  //保险公司
                  Row(
                    children: [
                      Text(
                        "保险公司",
                        style: TextStyle(fontSize: 12, color: Colors.black),
                      ),
                      Expanded(
                        child: Text(
                          "中国平安保险",
                          textAlign: TextAlign.right, // 设置文本右对齐
                          style: TextStyle(fontSize: 12, color: Colors.grey),
                        ),
                      ),
                    ],
                  ),
                  Gaps.vGap4,
                  Row(
                    children: [
                      Text(
                        "保单号",
                        style: TextStyle(fontSize: 12, color: Colors.black),
                      ),
                      Expanded(
                        child: Text(
                          "24187284913891934124",
                          textAlign: TextAlign.right, // 设置文本右对齐
                          style: TextStyle(fontSize: 12, color: Colors.grey),
                        ),
                      ),
                    ],
                  ),
                  Gaps.vGap4,
                  Row(
                    children: [
                      Text(
                        "购买产品",
                        style: TextStyle(fontSize: 12, color: Colors.black),
                      ),
                      Expanded(
                        child: Text(
                          "商业清洁雇主责任险-标准版",
                          textAlign: TextAlign.right, // 设置文本右对齐
                          style: TextStyle(fontSize: 12, color: Colors.grey),
                        ),
                      ),
                    ],
                  ),
                  Gaps.vGap4,
                  Row(
                    children: [
                      Text(
                        "保险期",
                        style: TextStyle(fontSize: 12, color: Colors.black),
                      ),
                      Expanded(
                        child: Text(
                          "2024-08-15至2025-08-15",
                          textAlign: TextAlign.right, // 设置文本右对齐
                          style: TextStyle(fontSize: 12, color: Colors.grey),
                        ),
                      ),
                    ],
                  ),
                  Gaps.vGap4,
                  Row(
                    children: [
                      Text(
                        "购买时间",
                        style: TextStyle(fontSize: 12, color: Colors.black),
                      ),
                      Expanded(
                        child: Text(
                          "2024-08-02",
                          textAlign: TextAlign.right, // 设置文本右对齐
                          style: TextStyle(fontSize: 12, color: Colors.grey),
                        ),
                      ),
                    ],
                  ),
                  Gaps.vGap4,
                  //保单号
                  Row(
                    children: [
                      Text(
                        "操作人",
                        style: TextStyle(fontSize: 12, color: Colors.black),
                      ),
                      Expanded(
                        child: Text(
                          "贾洋洋",
                          textAlign: TextAlign.right, // 设置文本右对齐
                          style: TextStyle(fontSize: 12, color: Colors.grey),
                        ),
                      ),
                    ],
                  ),
                  Gaps.vGap4,
                  Row(
                    children: [
                      Text(
                        "状态",
                        style: TextStyle(fontSize: 12, color: Colors.black),
                      ),
                      Expanded(
                        child: Text(
                          "未锁定，可自由更换被保人",
                          textAlign: TextAlign.right, // 设置文本右对齐
                          style: TextStyle(fontSize: 12, color: Colors.grey),
                        ),
                      ),
                    ],
                  ),
                ],
              ),
            ),
            //被保人信息
            Container(
              margin: EdgeInsets.only(top: 10),
              padding: EdgeInsets.only(left: 16, right: 16, top: 10, bottom: 10),
              color: Colors.white,
              child: Column(
                children: [
                  Row(
                    children: [
                      Text(
                        "被保人",
                        style: TextStyle(fontSize: 12, color: Colors.black),
                      ),
                      Expanded(
                        child: Text(
                          "该保单申请理赔后，将会被锁定，且不可更换被保人",
                          textAlign: TextAlign.right, // 设置文本右对齐
                          style: TextStyle(fontSize: 10, color: Colors.grey),
                        ),
                      ),
                    ],
                  ),
                  Gaps.vGap4,
                  Row(
                    children: [
                      Container(
                        margin: EdgeInsets.only(right: 10),
                        child: CustomAvatarView(
                          name: "王跃正",
                        ),
                      ),
                      const Expanded(
                        child: Column(
                          crossAxisAlignment: CrossAxisAlignment.start,
                          children: [
                            Text(
                              '王跃正(在职)',
                              textAlign: TextAlign.left,
                              style: TextStyle(
                                fontSize: 14,
                                fontWeight: FontWeight.bold,
                              ),
                            ),
                            Text(
                              '510522199904110923',
                              textAlign: TextAlign.left,
                              style: TextStyle(fontSize: 14),
                            ),
                          ],
                        ),
                      ),
                    ],
                  )
                ],
              ),
            ),
            //操作记录
            Container(
              margin: EdgeInsets.only(top: 10),
              padding: EdgeInsets.only(left: 16, right: 16, top: 10, bottom: 10),
              color: Colors.white,
              child: Expanded(
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.stretch, // 将crossAxisAlignment设置为CrossAxisAlignment.stretch
                  children: [
                    Text(
                      "操作记录：",
                      style: TextStyle(fontSize: 12, color: Colors.black),
                    ),
                    Gaps.vGap4,
                    Text(
                      "王跃正入职，王星星已离职，被保人从王星星更换为王跃正",
                      style: TextStyle(fontSize: 10, color: Colors.black),
                    ),
                    Text(
                      "2024.8.20  系统  自动操作",
                      style: TextStyle(fontSize: 10, color: Colors.grey),
                    ),
                  ],
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
}
